/**
 * @author LKQ
 * @date 2021/12/24 23:02
 * @description 数学求和
 */
public class Solution4 {
    public static void main(String[] args) {

    }

    public int missingNumber(int[] nums) {
        int n = nums.length;
        int total = n * (n + 1) / 2;
        int arrSum = 0;
        for (int i = 0; i < n; i++) {
            arrSum += nums[i];
        }
        return total - arrSum;
    }


}
